﻿using System;
using System.Data;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BaseData;
using BaseData.UI;
using TaxBiz.SysConfig;
using TaxEntity.SysConfig;

namespace Admin.SysConfig
{
    public partial class XiangzhenAdd : BaseCommon.BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!HasPower())
            {
                Jscript.AlertAndGoBack("您权限不足，不能操作");
                return;
            }
            string action = PageContext.GetRequest("action");
            if (!string.IsNullOrEmpty(action))
            {
                this.DoAction(action);
            }
        }

        protected bool DoAction(string action)
        {
            XiangzhenBiz db = new XiangzhenBiz();
            XiangzhenEntity de = new XiangzhenEntity();
            de.OptUserID = UserLogin.UserId;
            de.Code = PageContext.GetRequest("txtCode");
            de.Name = PageContext.GetRequest("txtName");
            int id = db.Add(de, UserLogin);
            if (id <= 0)
            {
                Jscript.Alert("添加失败");
                return false;
            }

            Jscript.AlertAndRedirect("添加成功", "XiangzhenAdd.aspx");
            return true;
        }
    }
}